﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EvaluationItemsPage.aspx.cs" Inherits="EvaluationSystem.ConfigurationPages.EvaluationItemsPages.EvaluationItemsPage" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

      <script type="text/javascript">
          var gridCommand = function (command, record) {

              if (command == "Edit") {
                  var id = record.data.Id;
                  Ext.net.DirectMethods.EditEvaluation(record.data.Id, record.data.SummaryName, record.data.Evaluation);
              }
              if (command == "Delete") {
                  Ext.Msg.confirm('提示', '您确定要删除?', function (btn) {
                      if (btn == 'yes') {
                          Ext.net.DirectMethods.DeleteEvaluation(record.data.Id);
                      }
                  });
              }
          };

    </script>
</head>
<body>
    <form id="form1" runat="server">
     <ext:ResourceManager ID="ResourceManager1" runat="server" />
     <ext:ToolTip ID="tooltipForSummary" 
            runat="server" 
            Target="cbbSummary" 
            Html="<table><tr><td>设置对应评分指标内容,显示在对应的评分指标项下.</td></tr></table>" 
            Title="评分指标项" 
            AutoHide="false" 
            Closable="true"
            Draggable="true"
             Shadow="Sides"
            />

         <asp:ObjectDataSource 
            ID="objectDataSource" 
            runat="server" 
            OnSelected="ObjectDataSource_Selected"
            SelectMethod="GetEvaluationFilter" 
            TypeName="EvaluationSystem.ConfigurationPages.EvaluationItemsPages.EvaluationItemsPage">
            <SelectParameters>
                <asp:Parameter Name="start" Type="Int32" />
                <asp:Parameter Name="limit" Type="Int32" />
                <asp:Parameter Name="sort" />
                <asp:Parameter Name="dir" />
                <asp:Parameter Name="count" Direction="Output" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>

        <ext:GridPanel ID="gpEvaluation" 
            runat="server" 
            Title="管理评分指标内容" 
          
             Height="500"
            AutoExpandColumn="Id">
            <Store>
                <ext:Store 
                    ID="store" 
                    runat="server" 
                    RemoteSort="true" 
                    DataSourceID="objectDataSource"
                    OnRefreshData="Store_RefreshData">
                    <AutoLoadParams>
                        <ext:Parameter Name="start" Value="0" Mode="Raw" />
                        <ext:Parameter Name="limit" Value="25" Mode="Raw" />
                    </AutoLoadParams>
                    <Reader>
                        <ext:JsonReader IDProperty="Id">
                            <Fields>
                                <ext:RecordField Name="Id" />
                                <ext:RecordField Name="SummaryName" />
                                <ext:RecordField Name="Evaluation"  />
                               
                            </Fields>
                        </ext:JsonReader>
                    </Reader>
                    <Proxy>
                        <ext:PageProxy />
                    </Proxy>
                 </ext:Store>
            </Store>

            <ColumnModel ID="ColumnModel1" runat="server">
                <Columns>
                   <ext:Column ColumnID="Id" Header="评分内容Id" Width="50" DataIndex="Id"/>
                    <ext:Column ColumnID="SummaryName" Header="对应评分项" Width="160" DataIndex="SummaryName"/>
                    <ext:Column  ColumnID="Evaluation" Header="评分指标内容" Width="500" DataIndex="Evaluation" >
                    <Renderer Handler="metadata.attr = 'style=white-space:normal;'; return value;"/>
                    </ext:Column>
 
                   
                    <ext:CommandColumn Width="60">
                        <Commands>
                            <ext:GridCommand Icon="Delete" CommandName="Delete">
                                <ToolTip Text="Delete" />
                            </ext:GridCommand>
                            <ext:CommandSeparator />
                            <ext:GridCommand Icon="NoteEdit" CommandName="Edit">
                                <ToolTip Text="Edit" />
                            </ext:GridCommand>
                        </Commands>
                    </ext:CommandColumn>
                </Columns>
            </ColumnModel>

            <SelectionModel>
                <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true" />
            </SelectionModel>
           <Listeners>
                <Command Handler="gridCommand(command, record);" />
            </Listeners>
             
              <BottomBar>
                <ext:PagingToolbar ID="PagingToolbar" 
                    runat="server" 
                    PageSize="25" 
                    DisplayInfo="true" 
                    DisplayMsg="显示评分内容 {0} - {1} 共 {2}" 
                    EmptyMsg="没有评分内容" 
                    />
            </BottomBar>
            <LoadMask ShowMask="true" />
        </ext:GridPanel>  
    </form>
</body>
</html>
